<?php defined('SUROBOT') or exit('No direct script access allowed');

//接收参数
$txt = Fun::GetParam('txt');
$server = Fun::GetParam('server');

//获取访问者IP
$position = json_decode(strstr(strstr(Fun::Curl("{$config['getip_api_url']}&ip=" . Fun::GetIp()), ';', true), '{'));
if($position) $position = $position->country . $position->province . $position->city;

//根据server进行接口分类
if(Fun::Equals($server, 'tuling')) {
	if($txt) {
		//加载图灵API操作类
		require __PER__ . 'TulingPer.php';
		header("content-type:text/plain; charset=utf-8");
		exit(TulingPer::SendMsg($txt));
	}
} else if(Fun::Equals($server, 'moli')) {
	if($txt) {
		//加载茉莉API操作类
		require __PER__ . 'MoliPer.php';
		header("content-type:text/plain; charset=utf-8");
		exit(MoliPer::SendMsg($txt));
	}
}

//加载视图
require __VIEWS__ . 'header.php';
require __VIEWS__ . 'index.php';
require __VIEWS__ . 'footer.php';